#include <event2/event.h>


int main(void){
    struct timeval tv1, tv2, tv3;

    /* Set tv1 = 5.5 seconds */
    tv1.tv_sec = 5; tv1.tv_usec = 500*1000;

    /* Set tv2 = now */
    evutil_gettimeofday(&tv2, NULL);

    /* Set tv3 = 5.5 seconds in the future */
    evutil_timeradd(&tv1, &tv2, &tv3);

    /* all 3 should print true */
    if (evutil_timercmp(&tv1, &tv1, ==))  /* == "If tv1 == tv1" */
        puts("5.5 sec == 5.5 sec");
    if (evutil_timercmp(&tv3, &tv2, >=))  /* == "If tv3 >= tv2" */
        puts("The future is after the present.");
    if (evutil_timercmp(&tv1, &tv2, <))   /* == "If tv1 < tv2" */
        puts("It is no longer the past.");
    return 0;
}
